package com.chenfan.finance.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chenfan.finance.model.CfSalesdeliverHeader;
import com.chenfan.finance.model.CfSalesorderDetail;
import com.chenfan.finance.model.TocSalesOrderDetail;
import com.chenfan.finance.model.vo.TimeRange;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
@Mapper
public interface CfSalesorderDetailMapper  extends BaseMapper<TocSalesOrderDetail> {



    /**
     * 根据tradeId 查询对应的交易详情
     * @param tradeId
     * @return
     */
    List<TocSalesOrderDetail> getDetailListByTradeId(Long tradeId);

    /**
     *
     * @param tid
     * @param oid
     * @return
     */
    List<TocSalesOrderDetail> getDetailsByTidAndOid(@Param("tid") String tid,@Param("oid") String oid);

    int insertList(@Param("list")List<TocSalesOrderDetail> list,@Param("taskYearMonth") LocalDateTime taskYearMonth);

    int insertListSimplify(@Param("list")List<TocSalesOrderDetail> list,@Param("taskYearMonth") LocalDateTime taskYearMonth);

    BigDecimal getTotalAmountByTid(@Param("tid") String tid,@Param("timeRange") TimeRange timeRange);

    List<TocSalesOrderDetail> getDetailListByTid(@Param("tid") String tid, @Param("timeRange")TimeRange timeRange);

    int copyDataToSimplify(TocSalesOrderDetail tocSalesOrderDetail);

    String getSkuCodeBySpecId(@Param("specId") String specId, @Param("timeRange")TimeRange timeRange);
}